import request from '@/utils/request.js'
const PATH = '/user/client'

// 用户登录
export const login = (data) => {
  return request.post(PATH + '/login', data)
}

// 用户注册
export const register = (data) => {
  return request.post(PATH + '/register', data)
}

// 检查token是否过期
export const checkUserToken = (token) => {
  return request.get(PATH + '/checkUserToken', {
    params: {
      token
    }
  })
}

// 获取用户信息
export const getUserInfo = (id) => {
  return request.get(PATH + '/getUserById', {
    params: {
      id
    }
  })
}

// 修改用户信息
export const updateUserInfo = (data) => {
  return request.put(PATH + '/update', data)
}

// 校验密码
export const checkPassword = (id, userPwd) => {
  return request.get(PATH + '/checkPwd', {
    params: {
      id,
      userPwd
    }
  })
}

// 修改密码
export const updatePwd = (data) => {
  return request.put(PATH + '/updatePwd', data)
}
